@model IEnumerable<University.Models.ScheduleItem>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        <th></th>
        <th>
            WeekDay
        </th>
        <th>
            Par
        </th>
        <th>
            Subject
        </th>
        <th>
            Professor
        </th>
        <th>
            Room
        </th>
        <th>
            StartTime
        </th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.ScheduleItemId }) |
            @Html.ActionLink("Details", "Details", new { id=item.ScheduleItemId }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.ScheduleItemId })
        </td>
        <td>
			@item.WeekDay
        </td>
        <td>
			@item.Par
        </td>
        <td>
			@(item.Subject == null ? "None" : item.Subject.Name)
        </td>
        <td>
			@(item.Professor == null ? "None" : item.Professor.LastName)
        </td>
        <td>
			@item.Room
        </td>
        <td>
			@String.Format("{0:g}", item.StartTime)
        </td>
    </tr>
}

</table>


